home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 May / CMCD0505.ISO / Software / Demo / DesktopX / objects / ktekdockv1.dxpack / {73FD5CF2-AAF5-4853-BE49-5C29CBE3C279}.DXScript2 < prev    next >
Extensible Markup Language  |  2004-08-24  |  5KB  |  157 lines

  1. <?xml version="1.0"?>
  2. <!--DXScript Data File.  Version 2.0-->
  3. <DXScript>
  4.     <Script><![CDATA[Dim thedate, themonth, theyear, theminute
  5. Dim firstdayofweek
  6. Dim gsX, gsY, oX, oY
  7. Dim viewdate, todaysdate, todaysitem
  8. Dim showingconfig
  9. Dim presets
  10. Dim thecolour
  11. Dim thebordercolour
  12. Dim R,G,B,dR,dG,dB
  13.  
  14. Sub Object_OnScriptEnter
  15.     theminute=Minute(Now)
  16.     firstdayofweek=1
  17.     getscale
  18.     viewdate=Now()
  19.     todaysdate=DateValue(viewdate)
  20.     Object.SetTimer 100, 1000
  21.     calnav("refresh")
  22. End Sub
  23.  
  24. Sub Object_Ontimer100
  25.     If desktopx.scriptobject("kddigitaltime").object.persiststorage("mode")="ampm" Then
  26.         digitime=FormatDateTime(Now,3)
  27.     Else
  28.         s=Cstr(Second(Now))
  29.         If len(s)=1 Then s="0"&s
  30.         digitime=FormatDateTime(Now,4)&":"&s
  31.     End If    
  32.     DesktopX.Object("kddigitaltime").Text=digitime
  33.     If Minute(Now)<>theminute Then
  34.         theminute=Minute(Now)
  35.     End If
  36.     If Day(Now())<>Day(todaysdate) Then 
  37.         calnav("refresh")
  38.         todaysdate=DateValue(Now())
  39.     End If
  40.     Exit Sub
  41.     If Month(viewdate)=Month(Now()) And Year(viewdate)=Year(Now()) And DateValue(todaysdate)<>DateValue(Now()) Then 
  42.         calnav("refresh")
  43.     ElseIf Day(Now())=1 And Day(todaysdate)<>1 Then 
  44.         calnav("refresh")
  45.         todaysdate=DateValue(Now())
  46.     End If
  47. End Sub
  48.  
  49. Sub getscale
  50.     gsX=18
  51.     gsY=10
  52.     oX=8
  53.     oY=8
  54. End Sub
  55.  
  56. Sub scalecal(thedate)
  57.     todaysitem=0
  58.     themonthnum=Month(thedate)
  59.     themonth=MonthName(themonthnum)
  60.     theyear=Year(thedate)
  61.     thedate=Day(thedate)
  62.     DesktopX.Object("kdcalmonth").Text=themonth
  63.     DesktopX.Object("kdcalyear").Text=theyear
  64.     'DesktopX.Object("kddigitalyear").Text=Year(Now)'time display
  65.     'DesktopX.Object("kddigitalday").Text=WeekDayName(Weekday(Now,1),False,1)'time display
  66.     'DesktopX.Object("kddigitaldate").Text=MonthName(Month(Now))&" "&Day(Now)
  67.     firstday=themonth&" 1,"&theyear
  68.     firstday=DatePart("w",firstday,firstdayofweek)
  69.     totaldays=daysinmonth(themonthnum,theyear)
  70.     i=1
  71.     For y=1 To 7
  72.         For x=1 To 7
  73.             If i<=7 Then
  74.                 DesktopX.Object("kd_date"&i).Text=WeekdayName(i,True,firstdayofweek)
  75.                 'DesktopX.Object("kd_date"&i).TextColor=RGB(103,191,255)
  76.             ElseIf i=Day(Now())+firstday-1+7 And themonthnum=Month(Now()) And theyear=Year(Now())Then
  77.                 DesktopX.Object("kd_date"&i).Text=i+1-firstday-7
  78.                 DesktopX.Object("kd_date"&i).TextColor=RGB(255,255,255)
  79.                 todaysdate=DateValue(Now())
  80.                 todaysitem=i
  81.             ElseIf i>=firstday+7 And i<firstday+totaldays+7 Then
  82.                     DesktopX.Object("kd_date"&i).Text=i+1-firstday-7
  83.                     DesktopX.Object("kd_date"&i).TextColor=RGB(103,191,255)                
  84.             Else
  85.                 If DesktopX.IsObject("kd_date"&i) Then
  86.                     DesktopX.Object("kd_date"&i).Text=""
  87.                 End If        
  88.             End If
  89.             i=i+1
  90.         Next
  91.     Next
  92.     i=1
  93.     'For y=1 To 7
  94.     '    For x=1 To 7
  95.     '        If DesktopX.IsObject("kd_date"&i) Then
  96.     '            DesktopX.Object("kd_date"&i).Move (x*gsX)-gsX+oX-(DesktopX.Object("kd_date"&i).Width/2),(y*gsY)-gsY+oY-(DesktopX.Object("kd_date"&i).Height/2)    
  97.     '        End If
  98.     '    i=i+1
  99.     '    Next
  100.     'Next    
  101. End Sub
  102.  
  103. Sub calnav(com)
  104.     viewmonth=Month(viewdate)
  105.     viewyear=Year(viewdate)
  106.     viewdate=Day(viewdate)
  107.     If com="kdcalnextmonth" Then        
  108.         If viewmonth=12 Then
  109.             viewyear=viewyear+1
  110.             viewmonth=1
  111.         Else
  112.             viewmonth=viewmonth+1    
  113.         End If
  114.     ElseIf com="kdcallastmonth" Then
  115.         If viewmonth=1 Then
  116.             viewyear=viewyear-1
  117.             viewmonth=12
  118.         Else
  119.             viewmonth=viewmonth-1    
  120.         End If
  121.     ElseIf com="kdcalnextyear" Then
  122.         viewyear=viewyear+1
  123.     ElseIf com="kdcallastyear" Then
  124.         viewyear=viewyear-1
  125.     ElseIf com="kdcaltoday" Then
  126.         viewmonth=Month(Now())
  127.         viewyear=Year(Now())
  128.         viewdate=Day(Now())
  129.     End If
  130.     'Object_Ontimer100
  131.     viewdate=MonthName(viewmonth)&" "&viewdate&","&viewyear
  132.     scalecal(viewdate)
  133. End Sub
  134.  
  135. Function daysinmonth(M, Y)
  136.     If Y = 0 Then
  137.     Y = Year(Now())
  138.   End If
  139.   Select Case (M)
  140.       Case 9, 4, 6, 11
  141.         daysinmonth = 30
  142.     Case 2
  143.           If (Y Mod 4 = 0) And (Y Mod 100 <> 0) Or (Y Mod 400 = 0) Then
  144.         daysinmonth = 29
  145.          Else
  146.         daysinmonth = 28
  147.          End If
  148.     Case Else
  149.     daysinmonth = 31
  150.     End Select
  151. End Function
  152.  
  153. Sub Object_OnScriptExit
  154.  
  155. End Sub
  156. ]]></Script><Globals><Editor><PropPane>0</PropPane><EditorLeft>197</EditorLeft><EditorTop>43</EditorTop><EditorRight>1247</EditorRight><EditorBottom>868</EditorBottom></Editor><Object><LanguageCLSID>{B54F3741-5B07-11CF-A4B0-00AA004A55E8}</LanguageCLSID><ControlCLSID>{00000000-0000-0000-0000-000000000000}</ControlCLSID><ControlObjWidth>64</ControlObjWidth><ControlObjHeight>64</ControlObjHeight><RunState>1</RunState><ManualControlLoad>0</ManualControlLoad><ScriptHostVersion>2</ScriptHostVersion></Object></Globals></DXScript>
  157.